<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="button" value="点击跳转百度" onclick="test()">

    <script>
        // setTimeout(function(){
        //     alert("警告框")
        // },5000)
        //定时器
        //参数1：执行的函数
        //参数2：定时的时间
        //参数3：5秒后弹出警告框
        function test()
        {
            console.log(location.href)
            location.href="https:www.baidu.com"
            //跳转
        }
    </script>
</body>
</html>